<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
	language="java"%>
<%@ include file="/jsp/platform/include/include.jsp"%>
<html>
<head>
<TITLE><c:out value="${_LOGONUSER_.MANAGETITILE}" /></TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<%@ include file="/jsp/platform/include/header.jsp"%>

	<script type="text/javascript">
		$(document).ready(function() {
			//开户行
			<common:getDicListByKey key="2100" var="depositBankList"/>
			
		})
		function resetForm() {
			document.agentInfoForm.reset();
		}
		function editAgentInfo() {
			var _agentType = $("#agentType").val();
			var checkStr = "need|agentLevel|代理等级|" + $("#agentLevel").val()
					+ ";" + "need|agentType|代理类型|" + $("#agentType").val()
					+ ";" + "need|contacts|联系人|" + $("#contacts").val() + ";"
					+ "need|mobilephone|手机|" + $("#mobilephone").val() + ";"
					+ "need|telephone|联系电话|" + $("#telephone").val() + ";"
					+ "need|email|邮箱|" + $("#email").val() + ";"
					+ "need|sysAccount|系统账号|" + $("#sysAccount").val() + ";"
//					+ "need|sysPassword|登陆密码|" + $("#sysPassword").val() + ";"
//					+ "need|depositBank|分润结算银行|" + $("#depositBank").val()
//					+ ";" + "need|depositBankbranch|结算支行|"
//					+ $("#depositBankbranch").val() + ";"
//					+ "need|bankUsrname|开户名|" + $("#bankUsrname").val() + ";"
//					+ "need|bankAccount|账户|" + $("#bankAccount").val() + ";"
					+ "need|bussBegindate|运营起始时间|" + $("input[name='agentInfoModel.bussBegindate']").val()
					+ ";" + "need|bussEnddate|运营终止时间|"
					+ $("input[name='agentInfoModel.bussEnddate']").val() + ";" + "mobile|mobilephone|手机|"
					+ $("#mobilephone").val() + ";" + "phone|telephone|联系电话|"
					+ $("#telephone").val() + ";" + "email|email|邮箱|"
					+ $("#email").val()
//					+ ";" + "domain|sysPassword|登录密码|"
//					+ $("#sysPassword").val() + "|6,18;"

			if (_agentType == '1') {
				checkStr = checkStr+
				"need|agentName|代理名称|" + $("#agentName").val() + ";"
						+ "need|identityNo|证件号|" + $("#identityNo").val() + ";"						
			} else if (_agentType == '2') {
				checkStr = checkStr+
				"need|companyName|公司名称|" + $("#companyName").val() + ";"
						+ "need|companyShortName|公司简称|"
						+ $("#companyShortName").val() + ";"					
			}
			//检验唯一性
			if (!checkAll(checkStr)) {
				return false;
			}
			$.messager.confirm("操作提示", "您确定要执行此操作吗！", function(data) {
				if (data) {
					$("#agentInfoForm").submit();
				}
			});
		}
	</script>
</HEAD>
<BODY>
	<DIV class="all">
		<%@ include file="/jsp/platform/include/head.jsp"%>
		<%@ include file="/jsp/platform/include/menu.jsp"%>
		<DIV class="mains">
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
				<TBODY>
					<TR valign="top">
						<%@ include file="/jsp/platform/include/mainLeft.jsp"%>
						<TD>
							<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
								<TBODY>
									<TR>
										<TD>
											<TABLE width="180" border="0" cellspacing="0" cellpadding="0">
												<TBODY>
													<TR>
														<TD width="7"><IMG width="7" height="36" alt=""
															src="<%=request.getContextPath()%>/images/pages_l.jpg">
														</TD>
														<TD align="center"
															background="<%=request.getContextPath()%>/images/pages_bg.jpg">
															<SPAN class="f_tit1">修改代理信息
														</SPAN></TD>
														<TD width="7"><IMG width="7" height="36" alt=""
															src="<%=request.getContextPath()%>/images/pages_r.jpg">
														</TD>
													</TR>
												</TBODY>
											</TABLE></TD>
									</TR>
								</TBODY>
								<TR>
									<TD>
										<div class="pages_con">
											<FORM name="agentInfoForm" id="agentInfoForm"
												action="<%=request.getContextPath()%>/manage/agentInfo/editForZdAgentInfo"
												method="post" enctype="multipart/form-data">
												<DIV class="transaction_external">
													<DIV class="clearfix">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">代理等级：</SPAN> <SPAN
															class="label dl_w"
															style="padding-left: 0px; text-align: center; height: 30px; width: 230px;">
															<select id="agentLevel" name="agentInfoModel.agentLevel"
															value="<c:out value='${model.agentInfoModel.agentLevel}'/>">
																<option value="">请选择</option>
																<!-- <option value="1">总代言人</option> -->
																<option value="2">高级代言人</option>
																<!-- <option value="3">城市运营商</option> -->
																<option value="4">普通代理</option>
														</select> </SPAN><span class="reds f_l">*</span> <SPAN
															class="label cz_label "
															style="width: 120px; text-align: right;">代理类型：</SPAN> 
															<SPAN
															class="label dl_w"
															style="padding-left: 0px; text-align: center; height: 30px; width: 230px;"><select
															id="agentType" name="agentInfoModel.agentType"
															value="<c:out value='${model.agentInfoModel.agentType}'/>">
															<option value="">请选择</option>
															<option value="1">个人</option>
															<option value="2">企业</option>
														</select></SPAN><span class="reds f_l">*</span>
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="clearfix" id="companyInfo">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">公司名称：</SPAN> <input
															type="hidden" id="agentId" name="agentInfoModel.agentId"
															value="<c:out value='${model.agentInfoModel.agentId}'/>">
															<input type="hidden" id="operatorId"
															name="operatorInfoModel.operatorId"
															value="<c:out value='${model.operatorInfoModel.operatorId}'/>">
																<INPUT name="agentInfoModel.companyName"
																class="txtbox_cz txtbox_cz_color input_change"
																id="companyName" type="text"
																value="<c:out value='${model.agentInfoModel.companyName}'/>">
																	<span class="reds f_l">*</span> <SPAN
																	class="label cz_label "
																	style="width: 120px; text-align: right;">公司简称：</SPAN> <INPUT
																	name="agentInfoModel.companyShortName"
																	class="txtbox_cz txtbox_cz_color input_change"
																	id="companyShortName" type="text"
																	value="<c:out value='${model.agentInfoModel.companyShortName}'/>">
																		<span class="reds f_l">*</span>
													</DIV>
													<DIV class="clearfix" id="personInfo">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">姓名：</SPAN> <INPUT
															name="agentInfoModel.agentName"
															class="txtbox_cz txtbox_cz_color input_change"
															id="agentName" type="text"
															value="<c:out value='${model.agentInfoModel.agentName}'/>">
															<span class="reds f_l">*</span> <SPAN
															class="label cz_label "
															style="width: 120px; text-align: right;">证件编号：</SPAN> <INPUT
															name="agentInfoModel.identityNo"
															class="txtbox_cz txtbox_cz_color input_change"
															id="identityNo" type="text"
															value="<c:out value='${model.agentInfoModel.identityNo}'/>">
																<span class="reds f_l">*</span>
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="clearfix">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">联系人：</SPAN> <INPUT
															name="agentInfoModel.contacts"
															class="txtbox_cz txtbox_cz_color input_change"
															id="contacts" type="text"
															value="<c:out value='${model.agentInfoModel.contacts}'/>">
															<span class="reds f_l">*</span> <SPAN
															class="label cz_label "
															style="width: 120px; text-align: right;">手机：</SPAN> <INPUT
															name="agentInfoModel.mobilephone"
															class="txtbox_cz txtbox_cz_color input_change"
															id="mobilephone" type="text"
															value="<c:out value='${model.agentInfoModel.mobilephone}'/>">
																<span class="reds f_l">*</span>
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="clearfix">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">联系电话：</SPAN> <INPUT
															name="agentInfoModel.telephone"
															class="txtbox_cz txtbox_cz_color input_change"
															id="telephone" type="text"
															value="<c:out value='${model.agentInfoModel.telephone}'/>"><span
															class="reds f_l">*</span> <SPAN class="label cz_label "
															style="width: 120px; text-align: right;">邮箱：</SPAN> <INPUT
															name="agentInfoModel.email"
															class="txtbox_cz txtbox_cz_color input_change" id="email"
															type="text"
															value="<c:out value='${model.agentInfoModel.email}'/>"><span
																class="reds f_l">*</span>
													</DIV>

													<DIV class="clearfix"></DIV>
													<DIV class="clearfix">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">系统账号：</SPAN> <INPUT
															name="agentInfoModel.sysAccount" readonly
															class="txtbox_cz txtbox_cz_color input_change"
															id="sysAccount" type="text"
															value="<c:out value='${model.agentInfoModel.sysAccount}'/>">
															<span class="reds f_l">*</span>
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="clearfix">
														<SPAN class="label cz_label"
															style="width: 120px; text-align: right;">运营起始：</SPAN> <SPAN
															class="label dl_w"
															style="padding-left: 0px; text-align: center; height: 30px; width: 230px;">
															<DIV class="select2 date">
																<INPUT name="agentInfoModel.bussBegindate"
																	class="easyui-datebox" id="bussBegindate"
																	style="border: none" type="text"
																	data-options="formatter:myformatter,parser:myparser"
																	value="<fmt:formatDate value='${model.agentInfoModel.bussBegindate}' type='date'/>">
															</DIV> </SPAN> <span class="reds f_l">*</span> <SPAN
															class="label cz_label"
															style="width: 120px; text-align: right;">运营终止:</SPAN> <SPAN
															class="label dl_w"
															style="padding-left: 0px; text-align: center; height: 30px; width: 230px;">
															<DIV class="select2 date">
																<INPUT name="agentInfoModel.bussEnddate"
																	class="easyui-datebox" id="bussEnddate"
																	style="border: none" type="text"
																	data-options="formatter:myformatter,parser:myparser"
																	value="<fmt:formatDate value='${model.agentInfoModel.bussEnddate}' type='date'/>">
															</DIV> </SPAN> <span class="reds f_l">*</span>
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="clearfix" id="personImg" name="fileDiv">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">身份证正面：</SPAN> 
															<IMG  width="300" height="400"  alt="身份证正面"  style="cursor:pointer"
																				src="<%=request.getContextPath()%>/uploadFile/${model.agentInfoModel.legalIndentityImg}">
														<span class="reds">*</span>
													</DIV>
													<DIV class="clearfix" id="companyImg" name="fileDiv">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">营业执照正面：</SPAN> 
														<IMG  width="300" height="400"  alt="营业执照正面"  style="cursor:pointer"
																				src="<%=request.getContextPath()%>/uploadFile/${model.agentInfoModel.bussinessImg}">
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="clearfix" id="settleCardFile" name="fileDiv">
														<DIV class="clearfix">
															<SPAN class="label cz_label "
																style="width: 120px; text-align: right;">结算银行卡正面：</SPAN>
															<IMG  width="300" height="400"  alt="结算银行卡正面"  style="cursor:pointer"
																				src="<%=request.getContextPath()%>/uploadFile/${model.agentInfoModel.settleCardImg}">
														</DIV>
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="clearfix">
														<SPAN class="label cz_label "
															style="width: 120px; text-align: right;">备注：</SPAN> <INPUT
															name="agentInfoModel.remark"
															class="txtbox_cz txtbox_cz_color input_change" id="remark" type="text"
															 value="<c:out value='${model.agentInfoModel.remark}'/>"
															> <span class="label">*如果是城市运营商 需要在此标注*</span>
													</DIV>
													<DIV class="clearfix"></DIV>
													<DIV class="note">
														<SPAN class="label cz_label">&nbsp;</SPAN> <A
															class="btn confirm" href="javascript:void(0);"
															style="margin-left: 114px;"
															onclick="javaScript:editAgentInfo('<c:out value="${model.agentInfoModel.agentId}"/>');">提交</A><A
															class="btn confirm" href="javascript:void(0);"
															onclick="javaScript:resetForm();">重置</A>
													</DIV>
												</DIV>
											</FORM>
											<!--当中内容块结束-->
										</div></TD>
								</TR>
							</TABLE></TD>
					</TR>
				</TBODY>
			</TABLE>
		</DIV>
		<%@ include file="/jsp/platform/include/foot.jsp"%>
		<script type="text/javascript">
			function dealAgentType()
			{
				var _agentType = $("#agentType").val();
				if (_agentType == "1") {
					$("div[id*='person']").each(function(i) {
						$(this).show();
					});
					$("div[id*='company']").each(function(i) {
						$(this).hide();
					});
				} else if (_agentType == "2") {
					$("div[id*='person']").each(function(i) {
						$(this).hide();
					});
					$("div[id*='company']").each(function(i) {
						$(this).show();
					});
				}
			}
			$("#agentType").change(function() {
				dealAgentType();
			});
			//这句放到页面最后 edit by wenjw 2015.6.2
			$("#agentType").val("<c:out value='${model.agentInfoModel.agentType}'/>");
			$("#agentLevel").val("<c:out value='${model.agentInfoModel.agentLevel}'/>");
			dealAgentType();
		</script>
</BODY>
</HTML>
